<template>
    <view class="sec_item ul">
        <Waterfall :listData="productArr">
            <template v-slot:left="{ list }">
                <span>啊是看得见哈卡视角和碍事的11111111111111111111111111111111111111111111111111家伙看啥机会的</span> 
                <!-- <view v-for="item in list" :key="item.id" class="left-content">
                    <view class="p productBox" @click="() => goClick(item, 'info')">
                        <view class="imgs">
                            <view class="sellOut" v-if="item.goodsNum <= 0">抢光啦</view>
                            <image :src="item.listPictureSrc" :lazy-load="true" mode="widthFix"></image>
                        </view>
                        <view class="info">
                            <view class="con-box">
                                <view class="name text-delic">
                                    <text class="">
                                        {{ item.goodsName }}
                                    </text>
                                </view>

                                <view class="words text-delic" v-if="item.labelArr && item.labelArr.length">
                                    <text class="keys" v-for="(labeli, idx3) in item.labelArr" :key="idx3">{{ labeli }}</text>
                                </view>
                            </view>

                            <view class="bottom">
                                <view class="price">
                                    <text class="big price-col">
                                        <text class="mini">￥</text>
                                        {{ item.salePrice }}
                                    </text>
                                    <text class="sell-num">已售2.7万</text>
                                </view>
                            </view>
                        </view>
                    </view>
                </view> -->
            </template>
            <template v-slot:right="{ rightList }">

                <span>啊是看得见哈卡视角和碍事的家伙看啥机会的</span> {{ rightList }}

                <view v-for="item,idx in rightList" :key="item.id" class="right-content">
                    <view class="p productBox" @click="() => goClick(item, 'info')">
                        <view class="imgs">
                            <view class="sellOut" v-if="item.goodsNum <= 0">抢光啦</view>
                            <image :src="item.listPictureSrc" :lazy-load="true" mode="widthFix"></image>
                        </view>
                        <view class="info">
                            <view class="con-box">
                                <view class="name text-delic">
                                    <text class="">
                                        {{ item.goodsName }}
                                    </text>
                                </view>

                                <view class="words text-delic" v-if="item.labelArr && item.labelArr.length">
                                    <text class="keys" v-for="(labeli, idx3) in item.labelArr" :key="idx3">{{ labeli }}</text>
                                </view>
                            </view>

                            <view class="bottom">
                                <view class="price">
                                    <text class="big price-col">
                                        <text class="mini">￥</text>
                                        {{ item.salePrice }}
                                    </text>
                                    <text class="sell-num">已售2.7万</text>
                                </view>
                            </view>
                        </view>
                    </view>
                </view>
            </template>
        </Waterfall>
    </view>
</template>

<script>
    import Waterfall from '@/components/Waterfall';
    const app = getApp();
    export default {
        props: {
            productArr: {
                type: Array,
                detault: []
            },
            hsBefore: {
                type: Boolean,
                default: false
            },
            isGroup: {
                type: Boolean,
                default: false
            },
            pageNum: {
                type: Number | String,
                default: 1
            }
        },
        components: { Waterfall },
        data() {
            return {
                activeBoxCssArr: [],
                rightList:[{goodsName:'几句哈'}]
            };
        },
        computed: {},
        onShow() {},

        methods: {
            goClick(row, type) {
                if (this.hsBefore) {
                    this.$emit('handleClick', row, type);
                } else {
                    if (type == 'info') {
                        this.$goNext('/pages/supermarket/product/index?id=' + row.id);
                    } else if (type == 'reser') {
                        if (app.globalData.userId) {
                            this.$preventRepeatClickOld(() => {
                                this.$axios({
                                    url: 'flash/supermarket/order/goods/reservation/saveorupdate',
                                    data: {
                                        goodsId: row.id,
                                        userId: app.globalData.userId
                                    }
                                }).then(res => {
                                    uni.showToast({
                                        title: '预约成功',
                                        duration: 2000
                                    });
                                });
                            }, 2000);
                        } else {
                            this.$goNext('/pages/supermarket/product/index?id=' + row.id);
                        }
                    }
                }
            }
        }
    };
</script>

<style scoped lang="scss">
    .sec_item {
        overflow: hidden;
        display: flex;
        flex-wrap: wrap;
        .li {
            // padding: 0px 10rpx 0px 10rpx;
            width: 48%;
            box-sizing: border-box;
            margin: 10rpx 0 20rpx;
            &:nth-child(2n) {
                margin-left: 4%;
            }
        }
    }
    // 商品
    .productBox {
        // box-shadow: 0 1px 10px #eaeaea;
        border-radius: 4px;
        // border: 1rpx solid #f1f1f1;
        // box-shadow: 3px 3px 14px #f5f0f0;
        background: #fff;
        border-radius: 20rpx;
        overflow: hidden;
        // padding: 20rpx;
        .imgs {
            position: relative;
            width: 100%;
            background: #fff;
            font-size: 0;
            overflow: hidden;
            image {
                width: 100%;
                height: 100%;
            }
            .sellOut {
                position: absolute;
                left: 0;
                bottom: 0;
                width: 100%;
                // background: rgb(255, 45, 70,.1);
                background: rgba(59, 62, 69, 0.8);
                color: #fff;
                padding: 10rpx 0;
                line-height: 1.1;
                font-size: 24rpx;
                text-align: center;
                letter-spacing: 2px;
            }
        }
        .info {
            padding: 10rpx;
            .tuijianTag {
                height: 66rpx;
                vertical-align: text-bottom;
                margin-right: 6rpx;
            }
            .lijian {
                // height: 34rpx;
                background: rgb(87, 180, 103);
                color: #fff;
                vertical-align: text-top;
                margin: 0 8rpx 0 0;
                font-size: 20rpx;
                padding: 5rpx 12rpx;
                border-radius: 6rpx 6rpx 6rpx 6rpx;
                position: relative;
                top: 5rpx;
            }
            .name {
                font-size: 28rpx;
                color: #333;
                // font-weight: bold;
                // height: 60rpx;
                // margin-bottom: 4rpx;
            }
            .con-box {
                // min-height: 178rpx;
            }
            .food-tag {
                padding: 2rpx 0;
                margin-left: -8px;
                min-height: 44rpx;
            }
            .words {
                padding: 4rpx 0 0;
                min-height: 38rpx;
                .keys {
                    color: #aaa;
                    line-height: 1.1;
                    font-size: 22rpx;
                    padding: 0rpx 0rpx;
                    // margin-left: 8rpx;
                    margin: 4rpx 10rpx 4rpx 0rpx;
                    display: inline-block;
                    vertical-align: top;
                }
            }
            .discount {
                min-height: 24rpx;
            }
            .bottom {
                // padding-top: 20rpx;
                // overflow: hidden;
                position: relative;
                min-height: 50rpx;
                // padding-bottom: 10rpx;
                .price {
                    // float: left;
                    // width: 100%;
                    color: #888;
                    font-size: 26rpx;
                    margin: 6rpx 0;
                    .old-price {
                        text-decoration: line-through;
                        font-size: 24rpx;
                    }
                    .big {
                        font-size: 32rpx;
                        color: #000;
                        font-weight: bold;
                    }
                    .sell-num {
                        font-size: 22rpx;
                        color: #aaa;
                        margin-left: 10rpx;
                    }
                }
                .buy-btn {
                    position: absolute;
                    right: 0;
                    top: 0;
                    text-align: right;
                    background: #fff;
                    .invite {
                        display: inline-block;
                        // width: 170rpx;
                        min-width: 170rpx;
                        font-size: 26rpx;
                        height: 60rpx;
                        line-height: 60rpx;
                        position: relative;
                        top: -10rpx;
                    }
                    .reservation {
                        background: #e89654;
                        color: #fff;
                    }
                }

                .mini {
                    font-size: 20rpx;
                }
            }
        }
        .tag {
            background-color: rgb(255, 248, 225);
            // background:#f5efd2 ;
            color: #e89654;
            line-height: 1.1;
            border-radius: 3rpx;
            font-size: 20rpx;
            padding: 4rpx 12rpx;
            // margin-left: 8rpx;
            margin: 4rpx 0 4rpx 8rpx;
            display: inline-block;
            vertical-align: top;
            &.red {
                background-color: #f7dce2; // background:#f5efd2 ;
                color: #ff2d46;
            }
            &.full.red {
                background-color: #ff2d46; // background:#f5efd2 ;
                color: #f7dce2;
            }
        }
    }
</style>
